package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Demo6 {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = null;
        try {
            inputStream = new FileInputStream("d:/test.txt");
            while (true) {
                int b = inputStream.read();
                if (b == -1) {
                    //读取完毕
                    break;
                }
                System.out.printf("0x%x ",b);   //以16进制输出


            }
    }
        finally {
            inputStream.close();
        }
        }
}
